package leetcode.code0754;

public class Solution {
	public int reachNumber(int target) {
		int numMoves = 0;
		target = Math.abs(target);
		long sum = 0;
		while (sum < target || ((sum - target) & 1) == 1) {
			sum += ++numMoves;
		}
		return numMoves;
	}
}
